import requests
from lxml import etree

url = "http://www.tipdm.com/sysjs/index.jhtml"
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36 Edg/93.0.961.52'
}
response = requests.get(url, headers=headers)
html = response.content.decode()
html = etree.HTML(html, parser=etree.HTMLParser(encoding='utf-8'))
result = etree.tostring(html, encoding='utf-8', pretty_print=True, method="html")
text = html.xpath('//*[@id="t496"]//div[@class="des"]/text()')
title = html.xpath('//*[@id="t496"]//div[@class="con"]/h1/a/text()')
with open('实验室建设.csv', 'w', encoding='utf-8') as f:
    for i, j in zip(title, text):
        f.write(i)
        f.write('\n')
        f.write(j)
        f.write('\n')
